package as.myapplication;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

/**
 * Created by Tm on 2017/7/5.
 */

public class Fragment1 extends Fragment {


    private LinearLayout layoutListOne;
    private TextView addWorkType;
    private Button btnAdd;
    private LinearLayout layoutList;
    private View view;


    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

        view = inflater.inflate(R.layout.group_list_view, container, false);
        return view;
    }

    @Override
    public void onResume() {
        super.onResume();

        layoutListOne = (LinearLayout) view.findViewById(R.id.layout_list_one);
        addWorkType = (TextView) view.findViewById(R.id.add_workType);
        btnAdd = (Button) view.findViewById(R.id.btn_add);
        layoutList = (LinearLayout) view.findViewById(R.id.layout_list);


        btnAdd.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MylistItems mylistItems = new MylistItems(getContext());
                layoutList.addView(mylistItems);
            }
        });
    }
}
